import {TreeNode} from "./Tree.mjs";
/**
 * 给你一棵二叉树的根节点 root ，翻转这棵二叉树，并返回其根节点。
 * https://leetcode.cn/problems/invert-binary-tree/description/?envType=study-plan-v2&envId=top-100-liked
 * @param root
 */
function invertTree(root: TreeNode | null): TreeNode | null {
    if(root == null) return root
    const temp = root.left
    root.left = invertTree(root.right)
    root.right = invertTree(temp)

    return root
};

const tree = new TreeNode(1, null, new TreeNode(2, new TreeNode((3)), null));
console.log(invertTree(tree));